Test for EOF on read in an1 reader.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 20 Jun 2006 01:49:43 +0000 (01:49 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 20 Jun 2006 01:49:43 +0000 (01:49 +0000)
git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@2169 f51c46e8-681c-474f-0cfe-069cfd0219fb

gpsbabel/an1.c

index 134335ee2021a35002e80b864896c6d1b1adc09e..e47af08d72307978c751dc9938a3afca1cf31b2c 100644 (file)
@@ -154,7 +154,9 @@ static unsigned char
 ReadChar( FILE *f )
 {
        unsigned char result = 0;
-       fread( &result, 1, 1, f );
+       if (fread( &result, 1, 1, f ) < 1) {
+               fatal( MYNAME ": error reading an1 file.  Perhaps this isn't really an an1 file.");
+       }
        return result;
 }